<template>
  <div>
    <div class="banner" @click="handleClickGallery">
      <img class="banner-img" :src="bannerImg" />
      <div class="banner-info">
        <div class="banner-title">{{this.title}}</div>
        <div class="banner-number">
          <span class="iconfont banner-icon">&#xe692;</span>
          39
        </div>
      </div>
    </div>
    <fade-animation>
      <gallery
        :imgs="imgs" 
        v-show="showGallery"
        @close-gallery="handleCloseGallery">
      </gallery>
    </fade-animation>
    
  </div>
</template>

<script>
import Gallery from "@/components/gallery/Gallery";
import FadeAnimation from "@/components/fade/FadeAnimation";
export default {
  name: "DetailBanner",
  props: {
    imgs: {
      type: Array,
      default() {
        return [];
      }
    },
    bannerImg: {
      type: String,
      default: ""
    },
    title: {
      type: String,
      default: ""
    }
  },
  components: {
    Gallery,
    FadeAnimation
  },
  data() {
    return {
      showGallery: false
    };
  },
  methods: {
    handleClickGallery() {
      this.showGallery = true;
    },
    handleCloseGallery() {
      this.showGallery = false;
    }
  }
};
</script>

<style lang="stylus" scoped>
@import '~styles/varibles.styl';

.banner {
  overflow: hidden;
  height: 0;
  padding-bottom: 55%;
  position: relative;

  .banner-img {
    width: 100%;
  }

  .banner-info {
    position: absolute;
    height: 0.6rem;
    display: flex;
    left: 0;
    right: 0;
    bottom: 0;
    color: #fff;
    background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));

    .banner-title {
      flex: 1;
      text-align: left;
      font-size: 0.32rem;
      padding: 0 0.2rem;
    }

    .banner-number {
      height: 0.32rem;
      line-height: 0.32rem;
      padding: 0 0.4rem;
      border-radius: 0.2rem;
      background: rgba(0, 0, 0, 0.8);
      font-size: 0.24rem;
    }

    .banner-icon {
      font-size: 0.24rem;
      color: #fff;
    }
  }
}
</style>